package cn.org.itool.ws.framework.event;

import cn.org.itool.ws.framework.netty.auth.Principal;
import cn.org.itool.ws.framework.netty.auth.Principal;

import java.util.StringJoiner;

/**
 * 关闭WS链接事件
 *
 */
public class CloseEvent extends WsEvent {

    /**
     * WS编号
     */
    private final String wsId;


    /**
     * 构造{@link CloseEvent}
     *
     * @param principal {@link Principal}
     * @param wsId WS编号
     */
    public CloseEvent(Principal principal, String wsId) {
        super(principal);
        this.wsId = wsId;
    }

    public String getWsId() {
        return wsId;
    }


    @Override
    public String toString() {
        return new StringJoiner(", ", CloseEvent.class.getSimpleName() + "[", "]")
                .add("wsId='" + wsId + "'")
                .toString();
    }
}
